# Maintainer: Morten Linderud <foxboron@archlinux.org>
# Contributor: Chad Kunde <Kunde21@gmail.com>

pkgname=gopls
pkgver=0.11.0
pkgrel=1
pkgdesc='Language server for Go programming language'
arch=('loong64' 'x86_64' 'aarch64' 'armv7h' 'armv7l')
url='https://github.com/golang/tools/tree/master/gopls'
license=('BSD')
depends=('glibc')
makedepends=('git' 'go')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/golang/tools/archive/gopls/v${pkgver}.tar.gz")
sha256sums=('b5dd0040bcc75b4760eb543826b6503a163c835c90f50843e626a112ca083931')

build() {
  cd "tools-${pkgname}-v${pkgver}/${pkgname}"

  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
  go build -o "${pkgname}"
}

package() {
  cd "tools-${pkgname}-v${pkgver}"
  install -Dm755 "${pkgname}/${pkgname}" -t "${pkgdir}"/usr/bin/
  install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}/"
}

# vim: ts=2 sw=2 et:
